home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-01-29 | 24.1 KB | 585 lines | [TEXT/MPS ] |
-
- ; Created: Monday, October 14, 1991 10:32 AM
- ;
- ; File: AppleEvents.a
- ;
- ; Assembler Interface to the Macintosh Libraries
- ; Copyright Apple Computer, Inc. 1991
- ; All Rights Reserved
- ;
- ;___________________________________________________________________________
-
- IF &TYPE('__IncludingAppleEvents__') = 'UNDEFINED' THEN
- __IncludingAppleEvents__ SET 1
-
- IF &TYPE('__IncludingTraps__') = 'UNDEFINED' THEN
- INCLUDE 'Traps.a'
- ENDIF
-
-
- typeLongInteger EQU 'long'
- typeShortInteger EQU 'shor'
- typeLongFloat EQU 'doub'
- typeShortFloat EQU 'sing'
- typeExtended EQU 'exte'
- typeComp EQU 'comp'
- typeMagnitude EQU 'magn'
- typeAEList EQU 'list'
- typeAERecord EQU 'reco'
- typeTrue EQU 'true'
- typeFalse EQU 'fals'
- typeAlias EQU 'alis'
- typeEnumerated EQU 'enum'
- typeType EQU 'type'
- typeAppParameters EQU 'appa'
- typeProperty EQU 'prop'
- typeFSS EQU 'fss '
- typeKeyword EQU 'keyw'
- typeSectionH EQU 'sect'
- typeWildCard EQU '****'
-
- typeApplSignature EQU 'sign'
- typeSessionID EQU 'ssid'
- typeTargetID EQU 'targ'
- typeProcessSerialNumber EQU 'psn '
- typeNull EQU 'null' ;the type of null/nonexistent data
-
- kCoreEventClass EQU 'aevt'
-
- kAEOpenApplication EQU 'oapp'
- kAEOpenDocuments EQU 'odoc'
- kAEPrintDocuments EQU 'pdoc'
- kAEQuitApplication EQU 'quit'
-
- kAECreatorType EQU 'crea'
- kAEQuitAll EQU 'quia'
- kAEShutDown EQU 'shut'
- kAERestart EQU 'rest'
- kAEApplicationDied EQU 'obit'
- keyProcessSerialNumber EQU 'psn '
-
- keyErrorNumber EQU 'errn'
- keyErrorString EQU 'errs'
-
- kAEAnswer EQU 'ansr'
-
- keyDirectObject EQU '----'
-
-
- ; keyword used in install special handler
- keyPreDispatch EQU 'phac' ; PreHandler Accessor Call
- keySelectProc EQU 'selh' ; More selector Call
-
- ; keywords used in attributes
- keyTransactionIDAttr EQU 'tran'
- keyReturnIDAttr EQU 'rtid'
- keyEventClassAttr EQU 'evcl'
- keyEventIDAttr EQU 'evid'
- keyAddressAttr EQU 'addr'
- keyOptionalKeywordAttr EQU 'optk'
- keyTimeoutAttr EQU 'timo'
- keyInteractLevelAttr EQU 'inte' ;this attribute is read only will be set in AESend
- keyEventSourceAttr EQU 'esrc' ; this attribute is read only
- keyMissedKeywordAttr EQU 'miss' ; this attribute is read only
-
- ; constants for use in AESendMode
- kAENoReply EQU $00000001 ; Sender doesn't want a reply to event
- kAEQueueReply EQU $00000002 ; Sender wants a reply but won't wait
- kAEWaitReply EQU $00000003 ; Sender wants a reply and will be waiting
-
- kAENeverInteract EQU $00000010 ; Server should not interact with user
- kAECanInteract EQU $00000020 ; Server may try to interact with user
- kAEAlwaysInteract EQU $00000030 ; Server should always interact with user where appropriate
-
- kAECanSwitchLayer EQU $00000040 ; Interaction may switch layer
-
- kAEDontReconnect EQU $00000080 ; don't reconnect if there is a sessClosedErr from PPCToolbox
-
- kAEWantReceipt EQU $00000200 ; Send wants a receipt of message
-
- ; constants to be used in AESendPriority
- kAENormalPriority EQU $00000000 ; Post message at the end of event queue
- kAEHighPriority EQU $00000001 ; Post message at the front of the event queue
-
- ; special constants in generating events
- kAnyTransactionID EQU 0 ; no transaction is in use
- kAutoGenerateReturnID EQU -1 ; AECreateAppleEvent will generate a session-unique ID
-
- ; constant for use AESend
- kAEDefaultTimeout EQU -1 ; timeout value determined by AEM
- kNoTimeOut EQU -2 ; wait until reply comes back, however long it takes
-
- ; dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch
- ;table, or one of these two constants
- kAENoDispatch EQU 0
- kAEUseStandardDispatch EQU -1
-
- ; Error messages in response to reading and writing event contents
- errAECoercionFail EQU -1700
- errAEDescNotFound EQU -1701
- errAECorruptData EQU -1702
- errAEWrongDataType EQU -1703
- errAENotAEDesc EQU -1704
- errAEBadListItem EQU -1705 ; Specified list item does not exist
- errAENewerVersion EQU -1706 ; Need newer version of AppleEvent Manager
- errAENotAppleEvent EQU -1707 ; The event is not in AppleEvent format
-
- ; Error messages in response to sending/receiving a message
- errAEEventNotHandled EQU -1708 ; The AppleEvent was not handled by any handler
- errAEReplyNotValid EQU -1709 ; AEResetTimer was passed an invalid reply parameter
- errAEUnknownSendMode EQU -1710 ; Mode wasn't NoReply, WaitReply, or QueueReply; or Interaction level is unknown
- errAEWaitCanceled EQU -1711 ; In AESend, User cancelled out of wait loop for reply or receipt
- errAETimeout EQU -1712 ; AppleEvent timed out
-
- errAENoUserInteraction EQU -1713 ; no user interaction allowed
- errAENotASpecialFunction EQU -1714 ; there is no special function with this keyword
- errAEParamMissed EQU -1715 ; a required parameter was not accessed
-
- errAEUnknownAddressType EQU -1716 ; The target address type is not known
- errAEHandlerNotFound EQU -1717 ; No handler in the dispatch tables fits the parameters to
- ; AEGetEventHandler or AEGetCoercionHandler
-
- errAEReplyNotArrived EQU -1718 ; the contents of the reply you are accessing have not arrived yet
- errAEIllegalIndex EQU -1719 ; Index is out of range in a put operation
-
- ; tagged data, the standard AppleEvent data type
- AEDesc RECORD 0
- descriptorType DS.L 1 ; DescType
- dataHandle DS.L 1 ; Handle
- size EQU *
- ENDR
-
-
- ;type of param to AEGetInteractionAllowed and AESetInteractionAllowed
- kAEInteractWithSelf EQU 0
- kAEInteractWithLocal EQU 1
- kAEInteractWithAll EQU 2
-
- ;Return param to AEGetTheCurrentEvent, and kAEEventSource attribute
- kAEUnknownSource EQU 0
- kAEDirectCall EQU 1
- kAESameProcess EQU 2
- kAELocalProcess EQU 3
- kAERemoteProcess EQU 4
-
-
- ; types for AppleEvent Array support
-
- ; Basic data type of attibutes & parameters
- AEKeyDesc RECORD 0
- descKey DS.L 1 ; AEKeyword
- descContent DS AEDesc
- size EQU *
- ENDR
-
-
- kAEDataArray EQU 0
- kAEPackedArray EQU 1
- kAEHandleArray EQU 2
- kAEDescArray EQU 3
- kAEKeyDescArray EQU 4
-
-
- ; Array routines support these different types of elements
- AEArrayData RECORD 0
- ORG AEArrayData
- AEDataArray DS.W 1 ; Array of short
- ORG AEArrayData
- AEPackedArray DS.B 1 ; Array of char
- ORG AEArrayData
- AEHandleArray DS.L 1 ; Array of Handle
- ORG AEArrayData
- AEDescArray DS.B AEDesc.size*1
- ORG AEArrayData
- AEKeyDescArray DS.B AEKeyDesc.size*1
- ORG
- size EQU *
- ENDR
-
-
-
- ; *********************************************************************
- ;The following calls apply to any AEDesc. Every result descriptor is created for you,
- ;so you will be responsible for memory management of the descriptors so created.
- ;Purgeable descriptor data is not supported: the AEM does not call LoadResource.
- MACRO
- _AECreateDesc
- MOVE.W #$0825,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AECoercePtr
- MOVE.W #$0A02,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AECoerceDesc
- MOVE.W #$0603,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEDisposeDesc
- MOVE.W #$0204,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEDuplicateDesc
- MOVE.W #$0405,D0
- _Pack8 ; A816
- ENDM
-
- ;*********************************************************************
- ; The following calls apply to AEDescList.
- ; Since AEDescList is a subtype of AEDesc, the calls in the previous
- ; section can also be used for AEDescList. All list and array indices are 1-based.
- ; If the data was greater than maximumSize in the routines below, then actualSize will
- ; be greater than maximumSize, but only maximumSize bytes will actually be retrieved.
- MACRO
- _AECreateList
- MOVE.W #$0706,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AECountItems
- MOVE.W #$0407,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEPutPtr
- MOVE.W #$0A08,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEPutDesc
- MOVE.W #$0609,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetNthPtr
- MOVE.W #$100A,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetNthDesc
- MOVE.W #$0A0B,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AESizeOfNthItem
- MOVE.W #$082A,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetArray
- MOVE.W #$0D0C,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEPutArray
- MOVE.W #$0B0D,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEDeleteItem
- MOVE.W #$040E,D0
- _Pack8 ; A816
- ENDM
-
- ;*********************************************************************
- ;The following calls apply to AERecord.
- ; Since AERecord is a subtype of AEDescList, the calls in the previous
- ; sections can also be used for AERecord
- ; an AERecord can be created by using AECreateList with isRecord set to true
- MACRO
- _AEPutKeyPtr
- MOVE.W #$0A0F,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEPutKeyDesc
- MOVE.W #$0610,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetKeyPtr
- MOVE.W #$0E11,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetKeyDesc
- MOVE.W #$0812,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AESizeOfKeyDesc
- MOVE.W #$0829,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEDeleteKeyDesc
- MOVE.W #$0413,D0
- _Pack8 ; A816
- ENDM
-
-
- ; *********************************************************************
- ; The following calls are used to pack and unpack parameters from records of
- ; type AppleEvent. Since AppleEvent is a subtype of AERecord, the calls in the previous
- ; sections can also be used for variables of type AppleEvent. The next six calls
- ; are in fact identical to the six calls for AERecord.
- MACRO
- _AEPutParamPtr
- MOVE.W #$0A0F,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEPutParamDesc
- MOVE.W #$0610,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetParamPtr
- MOVE.W #$0E11,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetParamDesc
- MOVE.W #$0812,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AESizeOfParam
- MOVE.W #$0829,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEDeleteParam
- MOVE.W #$0413,D0
- _Pack8 ; A816
- ENDM
-
- ;*********************************************************************
- ;The following calls also apply to type AppleEvent. Message attributes are far more restricted, and
- ;can only be accessed through the following 5 calls. The various list and record routines cannot be used
- ;to access the attributes of an event.
- MACRO
- _AEGetAttributePtr
- MOVE.W #$0E15,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEGetAttributeDesc
- MOVE.W #$0826,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AESizeOfAttribute
- MOVE.W #$0828,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEPutAttributePtr
- MOVE.W #$0A16,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEPutAttributeDesc
- MOVE.W #$0627,D0
- _Pack8 ; A816
- ENDM
-
- ;*********************************************************************
- ; The next four calls are basic routines used to create, send, and process AppleEvents.
- MACRO
- _AECreateAppleEvent
- MOVE.W #$0B14,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AESend
- MOVE.W #$0D17,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEProcessAppleEvent
- MOVE.W #$021B,D0
- _Pack8 ; A816
- ENDM
-
- ;During event processing, an event handler may realize that it is likely
- ;to exceed the client's timeout limit. Passing the reply to this
- ;routine causes a wait event to be generated to ask the client for more time.
- MACRO
- _AEResetTimer
- MOVE.W #$0219,D0
- _Pack8 ; A816
- ENDM
-
- ; *********************************************************************
- ;The following four calls are available for applications which need more sophisticated control
- ;over when and how events are processed. Applications which implement multi-session servers or
- ;which implement their own internal event queueing will probably be the major clients of these
- ;routines.
-
- ; Can be called from within a handler to prevent the AEM from disposing of
- ;the AppleEvent when the handler returns. Can be used to asynchronously process the
- ;event (as in MacApp).
- MACRO
- _AESuspendTheCurrentEvent
- MOVE.W #$022B,D0
- _Pack8 ; A816
- ENDM
-
-
- ; Tells the AppleEvent manager that processing is either about to resume or has
- ; been completed on a previously suspended event. The procPtr passed in as the
- ; dispatcher parameter will be called to attempt to redispatch the event. Several
- ; constants for the dispatcher parameter allow special behavior. They are:
- ; - kAEUseStandardDispatch means redispatch as if the event was just received, using the
- ; standard AppleEvent Dispatcher.
- ; - kAENoDispatch means ignore the parameter.
- ; Use this in the case where no redispatch is needed, and the event has been handled.
- ; - non nil means call the routine which dispatcher points to.
- MACRO
- _AEResumeTheCurrentEvent
- MOVE.W #$0818,D0
- _Pack8 ; A816
- ENDM
-
- ;Allows application to examine the currently executing event
- MACRO
- _AEGetTheCurrentEvent
- MOVE.W #$021A,D0
- _Pack8 ; A816
- ENDM
-
- ;Set the current event to the parameter
- MACRO
- _AESetTheCurrentEvent
- MOVE.W #$022C,D0
- _Pack8 ; A816
- ENDM
-
-
- ; *********************************************************************
- ; The following three calls are used to allow applications to behave courteously
- ; when a user interaction such as a dialog box is needed.
- MACRO
- _AEGetInteractionAllowed
- MOVE.W #$021D,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AESetInteractionAllowed
- MOVE.W #$011E,D0
- _Pack8 ; A816
- ENDM
-
- MACRO
- _AEInteractWithUser
- MOVE.W #$061C,D0
- _Pack8 ; A816
- ENDM
-
- ; *********************************************************************
- ; These calls are used to set up and modify the event dispatch table }
- ;
- ;{ Add an AppleEvent Handler
- MACRO
- _AEInstallEventHandler
- MOVE.W #$091F,D0
- _Pack8 ; A816
- ENDM
-
- ; Remove an AppleEvent Handler
- MACRO
- _AERemoveEventHandler
- MOVE.W #$0720,D0
- _Pack8 ; A816
- ENDM
-
- ; Get the corresponding AppleEvent Handler
- MACRO
- _AEGetEventHandler
- MOVE.W #$0921,D0
- _Pack8 ; A816
- ENDM
-
- ; *********************************************************************
- ; These calls are used to set up and modify the coercion dispatch table
- MACRO
- _AEInstallCoercionHandler
- MOVE.W #$0A22,D0
- _Pack8 ; A816
- ENDM
-
- ; Remove a Coercion Handler
- MACRO
- _AERemoveCoercionHandler
- MOVE.W #$0723,D0
- _Pack8 ; A816
- ENDM
-
- ; Get the corresponding Coercion Handler
- MACRO
- _AEGetCoercionHandler
- MOVE.W #$0B24,D0
- _Pack8 ; A816
- ENDM
-
-
- ; *********************************************************************
- ; These calls are used to set up and modify special hooks into the AppleEvent Manager.
-
- ; Install the special handler named by the Keyword
- MACRO
- _AEInstallSpecialHandler
- MOVE.W #$0500,D0
- _Pack8 ; A816
- ENDM
-
- ; Remove the special handler named by the Keyword
- MACRO
- _AERemoveSpecialHandler
- MOVE.W #$0501,D0
- _Pack8 ; A816
- ENDM
-
- ; Get the special handler named by the Keyword
- MACRO
- _AEGetSpecialHandler
- MOVE.W #$052D,D0
- _Pack8 ; A816
- ENDM
-
- ENDIF ; ...already included